package com.pupil.down.util.protocol;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @Description:
 * @Author: pupil
 * @Date: 2024/10/01 下午 8:58
 */
public class ProtocolFactory {

    private static Map<String, ProtocolUtil> utilMap = new HashMap<>();

    static {
        utilMap.put(ThunderUtil.PREFIX, new ThunderUtil());
    }

    /**
     * 获取连接转换工具
     *
     * @param url
     * @return
     */
    public static ProtocolUtil getUtil(String url) {
        Set<String> prefixes = utilMap.keySet();
        for (String prefix : prefixes) {
            if (url.startsWith(prefix)) {
                return utilMap.get(prefix);
            }
        }
        return null;
    }
}
